#import "SEGUsercancelapplicationManager.h"

#if __has_include(<Commom/SEGModel.h>)
#import <Commom/SEGModel.h>
#else
#import "SEGModel.h"
#endif
#if __has_include(<Commom/SEGHTTPBusinessManager.h>)
#import <Commom/SEGHTTPBusinessManager.h>
#else
#import "SEGHTTPBusinessManager.h"
#endif

static id _UsercancelapplicationManager;
static dispatch_once_t onceToken;

@implementation SEGUsercancelapplicationManager
#pragma mark - SINGLE----BEGIN----
+(instancetype)sharedManager{
    dispatch_once(&onceToken, ^{
        _UsercancelapplicationManager = [[self alloc] init];
    });
    return _UsercancelapplicationManager;
}

+(void)destroyResource{
    onceToken = 0;
    _UsercancelapplicationManager = nil;
}

#pragma mark - SINGLE----END----

#pragma mark - HTTP----BEGIN----
-(void)requestUsercancelapplicationWithEnterpriseuserid:(NSString*)enterpriseUserId finished:(void(^)(BOOL isSuccessed,id result,NSString* codeType,NSString* errorMessage))finished{
    
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    [params setValue:enterpriseUserId forKey:@"enterpriseUserId"];
    
    NSString *urlString = [SEGServerManager serverUrlJoint:kClientRootURL,@"/enterprise-app/user/cancelApplication.json",nil];
    [SEGHTTPBusinessManager seg_requestJSONWithMethod:POST URLString:urlString parameters:params completed:^(BOOL isSuccessed, id result, NSString *codeType, NSError *error) {
        if (!isSuccessed) {
            finished(isSuccessed,nil,codeType,error.localizedDescription);
            return;
        }
        
        self.Usercancelapplication = [SEGUsercancelapplicationModel yy_modelWithDictionary:result];
        finished(isSuccessed,result,codeType,error.localizedDescription);
        return;
    }];
//    [SEGHTTPBusinessManager seg_requestWithMethod:GET URLString:urlString parameters:params completed:^(BOOL isSuccessed, id result, NSString *codeType, NSError *error) {
//
//    }];
}
#pragma mark - HTTP----END----

#pragma mark - GETTER----BEGIN----
-(SEGUsercancelapplicationModel *)Usercancelapplication{
    if (!_Usercancelapplication) {
        _Usercancelapplication = [[SEGUsercancelapplicationModel alloc]init];
    }
    return _Usercancelapplication;
}
#pragma mark - GETTER----END----
@end

